// pages/category/category.js
Page({
  data: {
    categoryList: [
      { id: 1, name: "美妆护肤", icon: "💄" },
      { id: 2, name: "服装鞋包", icon: "👗" },
      { id: 3, name: "数码家电", icon: "📱" },
      { id: 4, name: "食品饮料", icon: "🍎" },
      { id: 5, name: "家居生活", icon: "🏠" },
      { id: 6, name: "运动户外", icon: "⚽" },
      { id: 7, name: "母婴用品", icon: "👶" },
      { id: 8, name: "图书文具", icon: "📚" },
      { id: 9, name: "汽车用品", icon: "🚗" },
    ],
  },

  onLoad() {
    console.log("分类页面加载");
  },

  onShow() {
    console.log("分类页面显示");

    // 主动更新TabBar选中状态
    const app = getApp();
    app.updateCustomTabBar();
  },

  selectCategory(e) {
    const category = e.currentTarget.dataset.category;
    wx.showToast({
      title: `选择了${category.name}`,
      icon: "none",
    });
  },
});
